#pragma once
#include <unistd.h>
#include <fcntl.h>

enum exitcode{//错误码
    USAGE_ERR=1,
    SOCKT_ERR,
    EPOLL_CREATE_ERR,
    PIPE_ERROR
};

enum oper{//epoll操作符
    ADD_EVENT,
    DEL_EVENT
};

void SetNonBlock(int fd){//将某个fd设置为非阻塞状态
    int fl=fcntl(fd,F_GETFL);
    if(fl==-1){
        LOG(ERROR)<<"fcntl error";
        return;
    }
    fcntl(fd,F_SETFL,fl|O_NONBLOCK);
}

